<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>背包</title>
    <link href="css/mui.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="css/aui.css"/>
    <link rel="stylesheet" href="css/shop.css">
    <link rel="stylesheet" href="css/alert.css">
    <script src="js/jquery-1.8.2.min.js"></script>
    <script src="js/mui.min.js"></script>
    <style>
        @media screen and (max-width:320px){
            .back_scroll_bg{height:56vh;}
            .back_order{height:60vh;}
        }
        @media screen and (min-width:376px) and (max-width:414px){
            .back_scroll_bg{height:74vh;}
            .back_order{height:70vh;}
        }

    </style>
    <script>
        //		未完成
        autoload=function(){
            var data={};
            data.user_id=user_id;
            data.userpwd=userpwd;
            if(user_id ==""){
                return;
            }
            $.ajax({
                type: "POST",
                //url: "http://test/jsonp.php",
                data: data,
                url: "http://xjh.taoleyizhan.com/wap/index.php?ctl=mainpage&show_prog=1",
                dataType: "json",
                success: function (json) {
                    console.log(json)
                    page_data=json;
                    var noticeList="";

                    for(var i=0;i<page_data.newest_lottery_list.length;i++){
                        noticeList+='<li class="ellipsis"><img src="images/jiangpin.png" alt="">恭喜'+page_data.newest_lottery_list[i].user_name+'获得'+page_data.newest_lottery_list[i].name+' </li>';
                    }
                    $("#lunbo1").html(noticeList)
                    $("#page_title").text(page_data.page_title)
                    $("#user_tx").attr("src",hostUrl+ page_data.user_logo);
                    $("#user_name").html(page_data.user_name);
                    $("#user_id").html(user_id);
                    $("#user_id").html("ID:"+page_data.id+"")
                    $("#jifen").html(page_data.user_money_int);
                    $("#jiushui").html(page_data.user_score)
                    InitChat();
                },
                error:function(json){
                    console.log(json);
                }
            });
        }
    </script>
    <script src="js/init.js"></script>
</head>
<body>
    <header class="mui-bar mui-bar-nav">
        <a href="index.html" class="mui-icon-undo mui-icon mui-icon-left-nav mui-pull-left"></a>
        <h1 class="mui-title" id="page_title">{$data.page_title}</h1>
    </header>

    <div class="mui-content">
        <div class="user re aui-mar-t-10 f12" style="height:50px;line-height:1.6;">
            <div class="re" style="width:55%;">
                <div class="user_bg ab" style="left:-10%;"></div>
                <div class="ab" style="z-index:2;">
                    <img id="user_tx" class="user_tx aui-mar-l-5" style="margin-top:-5px;width:50px;height:50px;" src="image/avatar.png" alt="">
                    <img class="ab" style="right:0;bottom:5px;" src="image/sex1.png" alt="" width="12">
                </div>
                <div class="ab aui-pad-t-5 aui-col-9 hidden" style="padding-left:70px;">
                    <div id="user_name" class="nowrap">小思设计2017小思</div>
                    <div id="user_id" class="nowrap" style="font-size:10px;">ID:123456</div>
                </div>
            </div>
            <div class="user_jf ab" style="width:45%;">
                <div class="user_bg ab" style="right:-10%;height:40px;"></div>
                <div class="index_buy ab f10"><a href="maiquan.html" class="aui-color-black">购 券</a></div>
                <div class="ab aui-col-6 nowrap" style="padding:10px 0 0 20px">
                    <img class="vmid aui-mar-r-5" src="images/zuan.png" alt="" width="14"><span id="jifen"></span>
                </div>
            </div>
        </div>
        <!--user信息-->

        <div class="aui-pad-10 f14">
            <div class="nav_sm flex mui-text-center f12">
                <div class="f1"><a href="uc_setting.html" class="aui-color-black"><img class="block aui-col-6 auto" src="images/index_set.png" alt="" width="40">设置</a></div>
                <div class="f1"><a href="help.html" class="aui-color-black"><img class="block aui-col-6 auto" src="images/index_help.png" alt="" width="40">帮助</a></div>
                <div class="f1"></div>
                <div class="f1"></div>
                <div class="f1"></div>
                <div class="f1"></div>
                <div class="f1"></div>
            </div>
            <!--<div class="flex f14 aui-pad-10 aui-border-radius" style="background:#fee630;box-shadow:3px 3px 3px #dab91e;">-->
                <!--<div class="f1"><img class="vmid border-r-1 aui-pad-r-10" src="images/jiebao.png" alt="" height="30"></div>-->
                <!--<div class="f5 border-r-1 hidden">-->
                    <!--<img class="vmid fl aui-mar-r-10 aui-mar-l-5" src="images/jiangpin.png" alt="" height="30">-->
                    <!--<div id="jiebao" style="width:75%;height:30px;overflow: hidden;color:#d80000;float:left;">-->
                        <!--<ul id="jiebao1">-->
                            <!--<li class="aui-mar-b-5 ellipsis nowrap">恭喜司马懿 在独闯江湖游戏中斩获冠军，获得一部iPhone7plus。</li>-->
                            <!--<li class="aui-mar-b-5 ellipsis nowrap">恭喜司马懿 在独闯江湖游戏中斩获冠军，获得一部iPhone7plus。</li>-->
                            <!--<li class="aui-mar-b-5 ellipsis nowrap">恭喜司马懿 在独闯江湖游戏中斩获冠军，获得一部iPhone7plus。</li>-->
                        <!--</ul>-->
                        <!--<ul id="jiebao2"></ul>-->
                    <!--</div>-->
                <!--</div>-->
                <!--<div class="f1 mui-text-right f12" style="line-height:30px;">更多</div>-->
            <!--</div>-->
            <!--江湖捷报-->
            <!--<div class="aui-mar-t-10"><img class="aui-col-10" src="images/duobao.png" alt=""></div>-->
        </div>

        <div class="backbox aui-col-10 mui-text-center fix " style="left:0;bottom:0;">
            <ul class="back_nav select ab mui-text-center aui-col-10 flex">
                <li class="action">背包</li>
                <li class="">订单</li>
                <li class="">待收货</li>
                <li class="">转增</li>
            </ul>
            <div class="back_scroll_bg f14">
                <div class="box_back" style="height:100%;overflow:hidden;">
                    <div class="nav_sec flex aui-col-7 auto">
                        <div class="f1 action">商品</div>
                        <div class="f1">礼物</div>
                        <div class="f1">其他</div>
                    </div>
                    <div class="nav_back" style="height:100%;overflow-y:auto;">
                        <ul class="list_box" id="shangpin">

                        </ul>
                        <ul class="list_box" id="liwu" style="display:none !important;">

                        </ul>
                        <ul class="list_box" id="qita" style="display:none !important;">

                        </ul>
                    </div>
                </div>
                <!--背包-->

                <div class="none" style="height:100%;">
                    <ul class="dingdan f12 mui-text-left" style="height:100%;overflow-y: auto;">
                        <li class="aui-border-b-gray aui-pad-10">
                            <div class="f12 aui-pad-b-5">购买时间：2017年11月11日 22:00</div>
                            <div class="flex">
                                <div class="f1 re">
                                    <img class="aui-background-gray aui-mar-r-10 fl" src="" alt="" width="60" height="60">
                                    <img style="position:absolute;width:90%;left:0;top:10px;" src="images/duo_zhongjiang.png" alt="">
                                </div>
                                <div class="f3">
                                    <div><b>商品名称</b></div>
                                    <div>订单编号:12356465511</div>
                                    <div>煮酒论英雄·4人赛·独闯江湖</div>
                                </div>
                                <div class="f1 aui-color-red mui-text-right">参与1次</div>
                            </div>
                        </li>
                    </ul>
                </div>
                <!--订单-->

                <div class="daishou none" style="height:100%;">
                    <ul class="f12 mui-text-left" style="height:100%;overflow-y: auto;">
                        <li class="aui-border-b-gray aui-pad-10">
                            <div class="f12 aui-pad-b-5">购买时间：2017年11月11日 22:00</div>
                            <div class="flex ">
                                <div class="f1"><img class="aui-background-gray aui-mar-r-10 fl" src="" alt="" width="60" height="60"></div>
                                <div class="f3">
                                    <div><b>商品名称</b></div>
                                    <div>订单编号:12356465511</div>
                                    <div>已发货/未发货</div>
                                </div>
                                <div class="f1">
                                    <div class="orange_btn mui-text-center" style="width:100%;">查看物流</div>
                                </div>
                            </div>
                        </li>
                    </ul>

                </div>
                <!--待收货-->

                <div class="box_zeng none" style="height:100%;overflow:hidden;">
                    <div class="nav_sec flex aui-col-7 auto">
                        <div class="f1 action">收到记录</div>
                        <div class="f1">转增记录</div>
                    </div>
                    <div class="nav_jilu mui-text-left">
                        <ul class="record f12" style="height:100%;overflow-y: auto;">

                        </ul>
                        <!--ul1-->
                        <ul class="zhuanzeng f12 none" style="height:100%;overflow-y: auto;">

                        </ul>
                        <!--ul2-->
                    </div>
                </div>
                <!--转增-->

            </div>
        </div>
        <!--背包列表-->
        <script>
            var data={};
            data.user_id=user_id;
            data.userpwd=userpwd;
            $.ajax({
                type: "POST",
                //url: "http://test/jsonp.php",
                data: data,
                url: "http://xjh.taoleyizhan.com/wap/index.php?ctl=user_center",
                dataType: "json",
                success: function (json) {
                    console.log(json)
                    page_data=json
                    $("#page_title").text(page_data.page_title);

                    var shangpin=""
                    if(page_data.shangpin){
                        for(var i=0;i<page_data.shangpin.length;i++){
                            shangpin+='<li><img class="aui-col-10 block" src="'+hostUrl+page_data.shangpin[i].icon+'" alt="" > <div class="list_con aui-pad-10 flex"> <div class="zengsong_btn f1 line-r" onclick="zengsong(0,'+page_data.shangpin[i].id+')">赠送</div> <div class="tihuo_btn f1" onclick="tihuo(0,'+page_data.shangpin[i].id+')">提货</div> </div> <div class="number shop_num ab">'+page_data.shangpin[i].num+'</div> </li>'
                        }
                    }
                    var liwu="";
                    if(page_data.liwu){
                        for(var i=0;i<page_data.liwu.length;i++){
                            liwu+='<li><img class="aui-col-10 block" src="'+hostUrl+page_data.liwu[i].icon+'" alt="" > <div class="list_con aui-pad-10 flex"> <div class="zengsong_btn f1 line-r" onclick="zengsong(1,'+page_data.liwu[i].id+')">赠送</div> <div class="tihuo_btn f1" onclick="tihuo(1,'+page_data.liwu[i].id+')">提货</div> </div> <div class="number shop_num ab">'+page_data.liwu[i].num+'</div> </li>'
                        }
                    }
                    var qita=""
                    if(page_data.qita.rcq_1>0){
                        qita+='<li><img class="aui-col-10 block" src="image/shop_one.png" alt="" > <div class="list_con aui-pad-10 flex"> <div class="f1 line-r"><a href="mengxiang.html" class="aui-color-black">使用</a></div> </div> <div class="number shop_num ab">'+page_data.qita.rcq_1+'</div> </li>'

                    }
                    if(page_data.qita.rcq_2>0){
                        qita+='<li><img class="aui-col-10 block" src="image/shop_two.png" alt="" > <div class="list_con aui-pad-10 flex"> <div class="f1 line-r"><a href="mengxiang.html" class="aui-color-black">使用</a></div> </div> <div class="number shop_num ab">'+page_data.qita.rcq_2+'</div> </li>'
                    }
                    $("#shangpin").html(shangpin)
                    $("#liwu").html(liwu)
                    $("#qita").html(qita)
                    InitChat();
                },
                error:function(json){
                    console.log(json);
                }
            });
            $.ajax({
                type: "POST",
                //url: "http://test/jsonp.php",
                data: data,
                url: "http://xjh.taoleyizhan.com/wap/index.php?ctl=user_center&act=order_list",
                dataType: "json",
                success: function (json) {
                    console.log(json)
                    page_data=json
                    $("#page_title").text(page_data.page_title);
                    var dingdan_list="";
                    for ( var i=0;i<page_data.order_list.length;i++){
                        dingdan_list='<li class="aui-border-b-gray aui-pad-10"> <div class="f12 aui-pad-b-5">获得时间：'+page_data.order_list[i].create_time+'</div> <div class="flex"> <div class="f1 re"> <img class="aui-background-gray aui-mar-r-10 fl" src="'+hostUrl+page_data.order_list[i].icon+'" alt="" width="60" height="60"> <img style="position:absolute;width:90%;left:0;top:10px;" src="images/duo_zhongjiang.png" alt=""> </div> <div class="f3"> <div><b>'+page_data.order_list[i].name+'</b></div> <div>订单编号:'+page_data.order_list[i].id+'</div> <div>煮酒论英雄·4人赛·独闯江湖</div> </div> <div class="f1 aui-color-red mui-text-right">参与1次</div> </div> </li>';
                    }
                    $(".dingdan").html(dingdan_list);

                },
                error:function(json){
                    console.log(json);
                }
            });
            // 订单

            $.ajax({
                type: "POST",
                //url: "http://test/jsonp.php",1
                data: data,
                url: "http://xjh.taoleyizhan.com/wap/index.php?ctl=user_center&act=tihuo_list",
                dataType: "json",
                success: function (json) {
                    console.log(json)
                    page_data=json
                    $("#page_title").text(page_data.page_title);
                    var daishou_list="";
                    for ( var i=0;i<page_data.tihuo_list.length;i++){
                        daishou_list+='<li class="aui-border-b-gray aui-pad-10 mui-text-left"> <div class="f12 aui-pad-b-5">提货时间：'+page_data.tihuo_list[i].create_time+'</div> <div class="flex"> <div class="f1 re"> <img class="aui-background-gray aui-mar-r-10 fl" src='+hostUrl+page_data.tihuo_list[i].icon+' alt="" width="60" height="60"> <img style="position:absolute;width:90%;left:0;top:10px;" src="images/duo_zhongjiang.png" alt=""> </div> <div class="f3"> <div><b>'+page_data.tihuo_list[i].name+'</b></div> <div>订单编号:'+page_data.tihuo_list[i].id+'</div> <div>已发货/未发货</div> </div> <div class="f1"><div class="orange_btn mui-text-center f12" style="width:100%;">查看物流</div></div> </div> </li>'

                    }
                    $(".daishou").html(daishou_list);
                    InitChat();
                },
                error:function(json){
                    console.log(json);
                }
            });
            // 待收货

        </script>
    </div>

    <!--alert开始-->
    <div class="alert f14 none">

        <div class="user_info box mui-text-center re none">
            <img class="user_tx ab aui-border-rasius-y" src="image/avatar.png" alt="" width="80" height="80">
            <div style="overflow:hidden;">
                <div class="aui-pad-b-5"><img class="aui-mar-r-10" src="image/sex1.png" alt="" width="14"><b>司马懿</b> <span class="f12">ID:999</span></div>
                <div class="mui-row aui-pad-10 line-height-2 mui-text-left">
                    <div class="mui-col-sm-7 mui-col-xs-7">
                        <div>段位：绿蓝带</div>
                        <div>胜率：77%</div>
                    </div>
                    <div class="mui-col-sm-5 mui-col-xs-5">
                        <div>幸运：9999</div>
                        <div>人气：999</div>
                    </div>
                </div>
                <div class="yes orange_btn auto">确定</div>
            </div>
        </div>
        <!--用户信息-->

        <div class="tihuo box re mui-text-center none">
            <div class="tc_btn">提货</div>
            <div class="mui-text-left aui-border-radius-30 aui-background-white aui-pad-10">
                你确定要提货吗？
            </div>
            <div class="mui-numbox aui-mar-t-10" data-numbox-min="0">
                <!-- "-"按钮，点击可减小当前数值 -->
                <button class="mui-btn mui-numbox-btn-minus"  type="button">-</button>
                <input class="mui-numbox-input" type="number" id="tihuo_num" value="1"/>
                <!-- "+"按钮，点击可增大当前数值 -->
                <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
            </div>
            <div class="flex aui-mar-t-10"><div class="cancel gray_btn auto">取消</div><div class="orange_btn auto" onclick="tihuo_go()"><a href="tihuo_dingdan.html">提货</a></div></div>
        </div>

        <div class="zengsong box re mui-text-center none">
            <div class="tc_btn">赠送</div>
            <div class="mui-text-left aui-border-radius-30 aui-background-white aui-pad-10">
                <input style="width:80%;margin:0;padding:0;height:auto;text-indent:20px;border:none;font:14px/16px '';" type="text" placeholder="请输入你的好友ID" id="search_user_id">
                <img class="zs_search fr" onclick="search()" src="image/search.png" alt="">
            </div>
            <div class="id none">
                <div class="id1 mui-text-left aui-pad-10"></div>
                <div class="id2 aui-mar-t-15">
                    <img id="id2_user_logo" class="aui-pad-r-10 fl" src="" alt="" width="50" height="50">
                    <div class="mui-text-left">
                        <div id="id2_user_name" class="nowrap">司马懿</div>
                        <div id="id2_id">ID:1235</div>
                    </div>
                </div>

                <div class="id3 mui-numbox aui-mar-t-10" data-numbox-min="0">
                    <!-- "-"按钮，点击可减小当前数值 -->
                    <button class="mui-btn mui-numbox-btn-minus"  type="button">-</button>
                    <input class="mui-numbox-input" type="number" id="zengsong_num" value="1"/>
                    <!-- "+"按钮，点击可增大当前数值 -->
                    <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
                </div>
            </div>
            <div class="flex aui-mar-t-10"><div class="cancel gray_btn auto">取消</div><div class="zs_yes orange_btn auto" onclick="zengsong_go()">赠送</div></div>
        </div>
        <!--搜索好友id-->

        <div class="zs_succ box re mui-text-center none">
            <div class="tc_btn">赠送成功</div>
            <div class="mui-text-left aui-border-radius-30 aui-background-white aui-pad-10 nowrap ellipsis">
                赠送成功。你的物品将在对方的背包里。
            </div>
            <div class="flex aui-mar-t-10"><div class="cancel gray_btn auto">取消</div><div class="yes orange_btn auto">确定</div></div>
        </div>

    </div>
    <!--alert end-->

    <input type="hidden" id="tihuo_type" value="" />
    <input type="hidden" id="id" value="" />
    <input type="hidden" id="isTrue" value="1" />
    <input type="hidden" id="zengsong_user_id" value="0" />

</body>
<script src="js/backpack.js"></script>
<script>
    function tihuo(type,id){
        $("#tihuo_type").val(type);
        $("#id").val(id);
        $(".alert").show();
        $(".tihuo").show();
    }
    function  tihuo_go(){
        var sendData={};
        sendData.user_id=user_id;
        sendData.userpwd=user_id;
        sendData.id=$("#id").val();
        sendData.num=$("#tihuo_num").val();
        sendData.type=$("#tihuo_type").val();
        var type=$("#tihuo_type").val();

        var num=$("#tihuo_num").val();
        var id=$("#id").val();
        var isTrue = $("#isTrue").val();
        console.log(id+num+type)
        if(isTrue==1){
            $("#isTrue").val(0);
            $.ajax({
                url: 'http://xjh.taoleyizhan.com/wap/index.php?ctl=user_center&act=tihuo_go',
                type: 'POST',
                data: sendData,
                dataType: "json",
                success: function (data) {
                    if(data.status=="1"){
                        alert(data.info);
                        location.href="";
                    }else{
                        alert(data.info);
                        $("#isTrue").val("1");
                    }
                },
                error: function () {
                    //alert("系统错误，请联系管理员");
                }
            });
        }
    }

    function zengsong(type,id){
        $("#tihuo_type").val(type);
        $("#id").val(id);
        $(".alert").show();
        $(".zengsong").show();
        $("#zengsong_user_id").val(0);
    }
    function search(){
        $(".id").hide();
        $(".id1").hide();
        $(".id2").hide();
        var search_user_id=$("#search_user_id").val();
        if(search_user_id!=''){
            var isTrue = $("#isTrue").val();
            if(isTrue==1){
                $("#isTrue").val(0);
                var data={};
                data.search_user_id=search_user_id;
                data.user_id=user_id;
                data.userpwd=userpwd;
                $.ajax({
                    url: hostUrl+'wap/index.php?ctl=user_center&act=search_user_id',
                    type: 'POST',
                    data: data,
                    dataType: "json",
                    success: function (data) {
                        console.log(data);
                        if(data.status=="1"){
                            //alert(data.info);
                            $("#id2_user_logo").attr("src",data.info.user_logo);
                            $("#id2_user_name").html(data.info.user_name);
                            $("#id2_id").html(data.info.id);
                            $("#zengsong_user_id").val(data.info.id);
                            $(".id2").show();
                            $(".id3").show();
                        }else{
                            $(".id1").html(data.info);
                            $("#id2_id").val(0)
                            $("#zengsong_user_id").val(0);
                            $(".id1").show();
                            $(".id3").hide();
                        }
                        $(".id").show();
                        $("#isTrue").val(1);
                    },
                    error: function () {
                        //alert("系统错误，请联系管理员");
                    }
                });
            }
        }
    }
    function zengsong_go(){
        var num=$("#zengsong_num").val();
        var id=$("#id").val();
        var zengsong_user_id=$("#zengsong_user_id").val();
        var isTrue = $("#isTrue").val();
        if(isTrue==1){
            $("#isTrue").val(0);
            var sendData={};
            sendData.type=$("#tihuo_type").val();
            sendData.num=num;
            sendData.id=id;
            sendData.zengsong_user_id=zengsong_user_id;
            sendData.user_id= user_id;
            sendData.userpwd=userpwd;
            console.log(sendData)
            $.ajax({
                url: hostUrl+'wap/index.php?ctl=user_center&act=zengsong_go',
                type: 'POST',
                data: sendData,
                dataType: "json",
                success: function (data) {
                    console.log(data)
                    if(data.status==1){
                        alert(data.info);
                        location.href="";
                        $(".alert").hide()
                        autoload()
                    }else{
                        alert(data.info);
                        $("#isTrue").val("1");
                    }
                },
                error: function () {
                    //alert("系统错误，请联系管理员");
                }
            });
        }
    }
    function duihuan(id){
        $("#id").val(id);
        $(".alert_bg").show();
        $(".alert_dh").show();
        $(".alert_th").hide();
        $(".alert_zs").hide();
    }
    function duihuan_go(){
        var type=$("#tihuo_type").val();
        var num=$("#duihuan_num").val();
        var id=$("#id").val();
        var isTrue = $("#isTrue").val();
        console.log(id+num)
        if(isTrue==1){
            $("#isTrue").val(0);
            $.ajax({
                url: hostUrl+'wap/index.php?ctl=user_center&act=duihuan_go',
                type: 'POST',
                data:  'id=' + id + '&num=' + num  + '&t=' + Math.random(),
                dataType: "html",
                success: function (data) {
                    if(data.status=="1"){
                        alert(data.info);
                        location.href="";
                    }else{
                        alert(data.info);
                        $("#isTrue").val("1");
                    }
                },
                error: function () {
                    //alert("系统错误，请联系管理员");
                }
            });
        }
    }

    $(".cancel").click(function(){
        $(".alert").hide();
        $(".tihuo").hide();
        $(".zengsong").hide();
        $(".id").hide();
    })
</script>
</html>